package com.detech.sbom.base.redis;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * spring缓存分组配置
 */
@Component
@ConfigurationProperties(prefix = "spring.cache.group")
public class CacheGroupProperties {

    private List<CacheGroup> cacheGroup;

    public List<CacheGroup> getCacheGroup() {
        return cacheGroup;
    }

    public void setCacheGroup(List<CacheGroup> cacheGroup) {
        this.cacheGroup = cacheGroup;
    }

    public static class CacheGroup {

        /**
         * 组id
         */
        private String groupId;

        /**
         * 组过期时间
         */
        private long ttl;

        /**
         * 组最大空闲时间
         */
        private long maxIdleTime;

        /**
         * 组最大长度
         */
        private int maxSize;

        public CacheGroup(){}

        public String getGroupId() {
            return groupId;
        }

        public void setGroupId(String groupId) {
            this.groupId = groupId;
        }

        public long getTtl() {
            return ttl;
        }

        public void setTtl(long ttl) {
            this.ttl = ttl;
        }

        public long getMaxIdleTime() {
            return maxIdleTime;
        }

        public void setMaxIdleTime(long maxIdleTime) {
            this.maxIdleTime = maxIdleTime;
        }

        public int getMaxSize() {
            return maxSize;
        }

        public void setMaxSize(int maxSize) {
            this.maxSize = maxSize;
        }
    }
}
